package org.example.Day4.Regex;

import java.util.Arrays;

public class Test3 {
    public static void main(String[] args){

        //将不是汉字部分替换为-
        String s1 = "古⼒娜扎ai8888迪丽热巴999aa5566⻢尔扎哈fbbfsfs42425卡尔扎巴";
        System.out.println(s1.replaceAll("\\w+","-"));

        //优化为 我喜欢编程
        String s2 = "我我我喜欢编编编编编编编编编编编编程程程";
        System.out.println(s2.replaceAll("(.)\\1+", "$1"));

        //取出人名字
        String s3 = "古⼒娜扎ai8888迪丽热巴999aa5566⻢尔扎哈fbbfsfs42425卡尔扎巴";
        String[] names = s3.split("\\w+");
        System.out.println(Arrays.toString(names));
    }
}
